#include<stdio.h>
int f(int year,int month)
{
    switch(month)
    {
        case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
            return 31;
        case 2:
            if(((year%4==0 && year%100!=0) || year%400==0))
                return 29;
            else
                return 28;
        default:
            return 30;
    }
}
  
int main()
{
    int year=0,month=0,day=0;
    scanf("%d-%d-%d",&year,&month,&day);
    day-=2;
    if(day<=0)
    {
        month--;
        if(month<=0)
        {
            year--;
            month=12;
        }
        day+=f(year,month);
    }
    printf("%04d-%02d-%02d",year,month,day);
    return 0;
}
